import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By

# 打开浏览器
service = Service(r'D:\Python3.14\chromedriver.exe')
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)
driver = webdriver.Chrome(service=service, options=chrome_options)   # 创建浏览器对象
# 输入访问网址
driver.get("http://121.43.169.97:8848/pageA.html")

# 滚动条到最底层     (左边距，上边距)
time.sleep(2)
js1 = "window.scrollTo(0,10000)"
driver.execute_script(js1)

# 滚动条到最顶层
time.sleep(2)
js2 = "window.scrollTo(0,0)"
driver.execute_script(js2)
